﻿using ENMAX_ArcGIS;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ESRI.ArcGIS.Client.Geometry;

namespace ENMAX_ArcGIS_TestProject
{
    
    
    /// <summary>
    ///This is a test class for TroubleTicketListItemTest and is intended
    ///to contain all TroubleTicketListItemTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TroubleTicketListItemTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for TroubleTicket
        ///</summary>
        [TestMethod()]
        public void TroubleTicketTest()
        {
            MapPoint mp1 = new MapPoint(100, 200);
            TroubleTicket tTicket = new TroubleTicket(mp1, "SampleTicket", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            TroubleTicketListItem target = new TroubleTicketListItem(tTicket);
            TroubleTicket actual;
            actual = target.TroubleTicket;

            Assert.AreEqual(actual.MapCoordinate, mp1, "MapPoint set fail");
            Assert.AreEqual(actual.Description, "SampleTicket", "Description set fail");
        }

        /// <summary>
        ///A test for IsOpen
        ///</summary>
        [TestMethod()]
        public void IsOpenTest()
        {
            TroubleTicket tTicket = new TroubleTicket(new MapPoint(), "SampleTicket", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            TroubleTicketListItem target = new TroubleTicketListItem(tTicket);
            bool expected = false;
            bool actual;
            target.IsOpen = expected;
            actual = target.IsOpen;
            Assert.AreEqual(expected, actual, "IsOpen flag fail");
        }

        /// <summary>
        ///A test for TroubleTicketListItem Constructor
        ///</summary>
        [TestMethod()]
        public void TroubleTicketListItemConstructorTest()
        {
            MapPoint mp1 = new MapPoint(100, 200);
            TroubleTicket tTicket = new TroubleTicket(mp1, "SampleTicket", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            TroubleTicketListItem target = new TroubleTicketListItem(tTicket);
            Assert.AreEqual("SampleTicket", target.TroubleTicket.Description, "Setting description failed");
            Assert.AreEqual(mp1, target.TroubleTicket.MapCoordinate, "Setting map coordinate failed");
        }
    }
}
